#ifndef _GWBASE_BASE_MUTEX_H_
#define _GWBASE_BASE_MUTEX_H_

#include <pthread.h>

namespace dicom {

class Mutex {
 public:
  Mutex();
  ~Mutex();

  void Lock();
  void Unlock();

 private:
  friend class CondVar;
  pthread_mutex_t mutex_;
};

class LockGuard {
 public:
  LockGuard(Mutex& m) : m_(m) { m_.Lock(); }
  ~LockGuard() { m_.Unlock(); }

 private:
  Mutex& m_;
};
}

#endif /* _GWBASE_BASE_MUTEX_H_ */
